local wuxin = fk.CreateSkill {
  name = "th_wuxin",
  tags = { Skill.Compulsory },
}

wuxin:addEffect(fk.CardUseFinished, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(wuxin.name) then
      return #player:getCardIds("h") > player.hp
    end
  end,
  on_cost = function(self, event, target, player, data)
    return player:getHandcardNum() - player.hp > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local x = player:getHandcardNum() - player.hp
    if x > 0 then
      local n = #room:askToDiscard(player, {
        min_num = x,
        max_num = x,
        include_equip = false,
        skill_name = wuxin.name,
        cancelable = false
      })
      player:drawCards(n, wuxin.name)
    end
  end
})
wuxin:addEffect(fk.EventPhaseProceeding, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(wuxin.name) then
      return player.phase == Player.Finish
    end
  end,
  on_cost = function(self, event, target, player, data)
    return player:getHandcardNum() < 4
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(4 - player:getHandcardNum(), wuxin.name)
  end
})

Fk:loadTranslationTable{
  ["th_wuxin"] = "无心",
  [":th_wuxin"] = "锁定技，你使用牌后，你将手牌弃置至体力值并摸弃置牌数张牌；结束阶段，你将手牌摸至四张。",
}

return wuxin